﻿USE lsk
GO

CREATE TABLE #AW_Staff(
	[StaffId] [uniqueidentifier] NOT NULL,
	[PhotoId] [varchar](50) NULL,		
	[MediumUrl] [varchar](500) NULL,
	[SmallUrl] [varchar](500) NULL,
	[LargeUrl] [varchar](500) NULL,
	[pictureURL] [nvarchar](250) NULL,
)

BULK
INSERT #AW_Staff
FROM 'D:\Cloud\SkyDrive\LSK\MigrationTool\Script\AW_Staff.csv'
WITH
(
FIELDTERMINATOR = ',',
ROWTERMINATOR = '\n'
)
GO

SELECT * FROM #AW_Staff

BEGIN Tran
UPDATE AW SET AW.PhotoId = temp.PhotoId,
			  AW.pictureURL = temp.pictureURL,
			  AW.MediumUrl = temp.MediumUrl,
			  AW.SmallUrl = temp.SmallUrl,
			  AW.LargeUrl = temp.LargeUrl
	FROM AW_Staff AW
JOIN #AW_Staff temp on temp.StaffId = AW.StaffId

commit tran


DROP TABLE #AW_Staff

PRINT '==========================DONE Update AW Staff=========================='







